import { createRouter, createWebHashHistory } from 'vue-router'
import otherPage from './otherPage'
import cssPage from './cssPage'
import jsPage from './jsPage'
import vuePage from './vuePage'
const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            redirect: '/btns/btn1',
            children: [
                {
                    path: '/btns',
                    meta: { title: '按钮' },
                    children: [
                        {
                            path: 'btn1',
                            component: () => import('@/views/btns/btn1'),
                            meta: {
                                title: 'btn1',
                            },
                        },
                    ],
                },
                {
                    path: '/others',
                    meta: { title: '测试页面' },
                    children: otherPage,
                },
                {
                    path: '/cssPage',
                    meta: { title: 'css页面' },
                    children: cssPage,
                },
                {
                    path: '/jsPage',
                    meta: { title: 'js页面' },
                    children: jsPage,
                },
                {
                    path: '/vue',
                    name: 'Vue',
                    meta: { title: 'Vue' },
                    children: vuePage,
                },
            ],
        },
    ],
})
router.beforeEach((form, to, next) => {
    console.log('beforeEach', form, to)
    next()
})

export default router
